Creating A Raw Disk Image

After you've set up a disk partition the way you like -- and shrunk the partition as far as possible! -- you can make a raw disk image for it from the command line.  (I even tried some advanced options, but was unable to make the Disk Utility GUI produce such an image).

Note that to run these commands, you may need to read Identifying A Disk Volume.

Recommended Method

This is the command I recommend:

hdiutil create -srcdevice /dev/rdisk0s3 -format UDTO -layout NONE recovery_hd

To run this, you'll need to know and specify:

  • the source of the partition data.  It follows '-srcdevice' and can be specified in many ways, such as a raw device or a mount point (ex. "/Volumes/Recovery HD") if the volume is mounted.
  • the file to save the data too.  This is specified at the end, and a '.cdr' is added to the end of it.
  • the other parameters specify the exact format we need, in effect saying, "Don't package this up -- I just want the raw data".

You will be prompted for a password after you execute the command.

4a41889c-335b-48c5-8b95-2f94ee8aa0bb.png


Alternative Method

This method gives you no indication of what the progress is, so it wouldn't be my first choice, but it does illustrate that the resulting disk image file is the raw data right from the drive.  [You could also use a variation of this to build your disk image from, say, Linux].

Assuming your partition is disk0s3, here are the commands to make an image of it:

diskutil unmount /dev/rdisk0s3

sudo dd if=/dev/rdisk0s3 of=recovery_hd.dd bs=1m

diskutil mount /dev/rdisk0s3

The first command unmounts the volume (so that nothing is using it while you are trying to make an image of it!) and the last command mounts it again.

The middle command makes a raw copy of it.  'if' is the input file (or device represented by a file).  'of' is the output file.  'bs' is the block size; I'm telling it to do it 1 mb at a time.  (This is faster than the result if you don't specify it).

When you are done, your Terminal looks like this:

918b7bef-c05c-4193-924d-a86931f7703f.png


The Results Are The Same

Both commands yield identical results (as seen here, they are the same size and have the same checksum).

14523847-4bf5-4d2f-9d54-266c65f632cc.png


Next: Copying Your Disk Image